//
// Created by Administrator on 2024/7/31.
//

#include "vehicle_positioning_info.h"

#include "../../msgpack/MessagePackWriter.h"
#include "../../msgpack/messagepack_reader.h"

namespace protocol {
    void VehiclePositioningInfo::serialize(MessagePackWriter &writer) {
        JTT809Body::serialize(writer);
        writer.writeByte(encrypt);
        writer.writeUint(dataLength);
        writer.writeUint(alarm);
        writer.writeUint(status);
        writer.writeUint(lat);
        writer.writeUint(lng);
        writer.writeUint(height);
        writer.writeUint(vel);
        writer.writeUint(direction);
        writer.writeByte(year);
        writer.writeByte(month);
        writer.writeByte(day);
        writer.writeByte(hour);
        writer.writeByte(minute);
        writer.writeByte(second);
        writer.writeBytes(platformId1);
        writer.writeUint(alarm1);
        writer.writeBytes(platformId2);
        writer.writeUint(alarm2);
        writer.writeBytes(platformId3);
        writer.writeUint(alarm3);
    }

    void VehiclePositioningInfo::deserialize(MessagePackReader &reader) {
        JTT809Body::deserialize(reader);
        reader.readByte(encrypt);
        reader.readUint(dataLength);
        reader.readUint(alarm);
        reader.readUint(status);
        reader.readUint(lat);
        reader.readUint(lng);
        reader.readUint(height);
        reader.readUint(vel);
        reader.readUint(direction);
        reader.readByte(year);
        reader.readByte(month);
        reader.readByte(day);
        reader.readByte(hour);
        reader.readByte(minute);
        reader.readByte(second);
        reader.readBytes(platformId1);
        reader.readUint(alarm1);
        reader.readBytes(platformId2);
        reader.readUint(alarm2);
        reader.readBytes(platformId3);
        reader.readUint(alarm3);
    }
} // jtt809